package com.nazca.tvremote.event;

import org.json.JSONException;
import org.json.JSONObject;

import android.view.KeyEvent;

public class RemoteKeyEvent {
	
//	KeyEvent(long downTime, long eventTime, int action, int code, int repeat, int metaState) 
	private KeyEvent mKeyEvent;
	
	public RemoteKeyEvent(KeyEvent origEvent){
		mKeyEvent = origEvent;
	}
	
	@Override
	public String toString() {
		JSONObject json = new JSONObject();
		
		try {
			json.put("EventType", "KeyEvent");
			
			JSONObject event = new JSONObject();
			json.put("Event", event);
			
//			event.put("downTime", mKeyEvent.getDownTime());
//			event.put("eventTime", mKeyEvent.getEventTime());
			event.put("action", mKeyEvent.getAction());
			event.put("code", mKeyEvent.getKeyCode());
//			event.put("repeat", mKeyEvent.getRepeatCount());
//			event.put("metaState", mKeyEvent.getMetaState());
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		return json.toString();
	}
	
}
